The LA_EIGENPROBLEM function uses the QR algorithm to compute all eigenvalues λ and eigenvectors v ≠ 0 of an n-by-n real nonsymmetric or complex non-Hermitian array A, for the eigenproblem Av = λv. The routine can also compute the left eigenvectors u ≠ 0, which satisfy uHA = λuH.
LA_EIGENPROBLEM may also be used for the generalized eigenproblem:
Av = λBv and uHA = λuHB
where A and B are square arrays, v are the right eigenvectors, and u are the left eigenvectors.
LA_EIGENPROBLEM is based on the following LAPACK routines:
Output Type |
Standard LAPACK Routine |
Generalized LAPACK Routine |
Float |
sgeevx |
sggevx |
Double |
dgeevx |
dggevx |
Complex |
cgeevx |
cggevx |
Double complex |
zgeevx |
zggevx |
For details see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.
Result = LA_EIGENPROBLEM( A [, B] [, ALPHA=variable] [, BALANCE=value] [, BETA=variable] [, /DOUBLE] [, EIGENVECTORS=variable] [, LEFT_EIGENVECTORS=variable] [, NORM_BALANCE = variable] [, PERMUTE_RESULT=variable] [, SCALE_RESULT=variable] [, RCOND_VALUE=variable] [, RCOND_VECTOR=variable] [, STATUS=variable] )
The result is a complex n-element vector containing the eigenvalues.
The real or complex array for which to compute eigenvalues and eigenvectors.
An optional real or complex n-by-n array used for the generalized eigenproblem. The elements of B are converted to the same type as A before computation.
For the generalized eigenproblem with the B argument, set this keyword to a named variable in which the numerator of the eigenvalues will be returned as a complex n -element vector. For the standard eigenproblem this keyword is ignored.
Tip: The ALPHA and BETA values are useful for eigenvalues which underflow or overflow. In this case the eigenvalue problem may be rewritten as αAv = βBv.
Set this keyword to one of the following values:
The default is BALANCE = 1, which performs both permutation and scaling balances. Balancing a nonsymmetric (or non-Hermitian) array is recommended to reduce the sensitivity of eigenvalues to rounding errors.
For the generalized eigenproblem with the B argument, set this keyword to a named variable in which the denominator of the eigenvalues will be returned as a real or complex n-element vector. For the standard eigenproblem this keyword is ignored.
Tip: The ALPHA and BETA values are useful for eigenvalues which underflow or overflow. In this case, the eigenvalue problem may be rewritten as αAv = βBv.
Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if A is double precision, otherwise the default is DOUBLE = 0.
Set this keyword to a named variable in which the eigenvectors will be returned as a set of row vectors. If this variable is omitted then eigenvectors will not be computed unless the RCOND_VALUE or RCOND_VECTOR keywords are present.
Note: For the standard eigenproblem the eigenvectors are normalized and rotated to have norm 1 and largest component real. For the generalized eigenproblem the eigenvectors are normalized so that the largest component has abs(real) + abs(imaginary) = 1.
Set this keyword to a named variable in which the left eigenvectors will be returned as a set of row vectors. If this variable is omitted then left eigenvectors will not be computed unless the RCOND_VALUE or RCOND_VECTOR keywords are present.
Note: Note - For the standard eigenproblem the eigenvectors are normalized and rotated to have norm 1 and largest component real. For the generalized eigenproblem the eigenvectors are normalized so that the largest component has abs(real) + abs(imaginary) = 1.
Set this keyword to a named variable in which the one-norm of the balanced matrix will be returned. The one-norm is defined as the maximum value of the sum of absolute values of the columns. For the standard eigenproblem, this will be returned as a scalar value; for the generalized eigenproblem this will be returned as a two-element vector containing the A and B norms.
Set this keyword to a named variable in which the result for permutation balancing will be returned as a two-element vector [ilo, ihi]. If permute balancing is not done then the values will be ilo = 1 and ihi = n.
Set this keyword to a named variable in which the reciprocal condition numbers for the eigenvalues will be returned as an n-element vector. If RCOND_VALUE is present then left and right eigenvectors must be computed.
Set this keyword to a named variable in which the reciprocal condition numbers for the eigenvectors will be returned as an n-element vector. If RCOND_VECTOR is present then left and right eigenvectors must be computed.
Set this keyword to a named variable in which the results for permute and scale balancing will be returned. For the standard eigenproblem, this will be returned as an n-element vector. For the generalized eigenproblem, this will be returned as a n-by-2 array with the first row containing the permute and scale factors for the left side of A and B and the second row containing the factors for the right side of A and B.
Set this keyword to a named variable that will contain the status of the computation. Possible values are:
Note: If STATUS is not specified, any error messages will be output to the screen.
Find the eigenvalues and eigenvectors for an array using the following program:
PRO ExLA_EIGENPROBLEM
; Create a random array:
n = 4
seed = 12321
array = RANDOMN(seed, n, n)
; Compute all eigenvalues and eigenvectors:
eigenvalues = LA_EIGENPROBLEM(array, $
EIGENVECTORS = eigenvectors)
PRINT, 'LA_EIGENPROBLEM Eigenvalues:'
PRINT, eigenvalues
; Check the results using the eigenvalue equation:
maxErr = 0d
FOR i = 0, n - 1 DO BEGIN
; A*z = lambda*z
alhs = array ## eigenvectors[*,i]
arhs = eigenvalues[i]*eigenvectors[*,i]
maxErr = maxErr > MAX(ABS(alhs - arhs))
ENDFOR
PRINT, 'LA_EIGENPROBLEM Error:', maxErr
; Now try the generalized eigenproblem:
b = IDENTITY(n) + 0.01*RANDOMN(seed, n, n)
eigenvalues = LA_EIGENPROBLEM(Array, B)
PRINT, 'LA_EIGENPROBLEM Generalized Eigenvalues:'
PRINT, EIGENVALUES
END
ExLA_EIGENPROBLEM
When this program is compiled and run, IDL prints:
LA_EIGENPROBLEM eigenvalues:
( -0.593459, 0.566318)( -0.593459, -0.566318)
( 1.06216, 0.00000)( 1.61286, 0.00000)
LA_EIGENPROBLEM error: 4.0978193e-07
LA_EIGENPROBLEM generalized eigenvalues:
( -0.574766, 0.567452)( -0.574766, -0.567452)
( 1.57980, 0.00000)( 1.08711, 0.00000)
5.6 |
Introduced |